import Vue from 'vue';
import VueI18n from 'vue-i18n';
import ElementUI from 'element-ui'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
Vue.use(VueI18n);
export default ({
	app,
	store
}) => {
	// Set i18n instance on app
	// This way we can use it in middleware and pages asyncData/fetch
	let en = require('~/locales/en_US.json');
	let cn = require('~/locales/zh_CN');
	app.i18n = new VueI18n({
		locale: store.state.locale,
		fallbackLocale: 'zh_CN',
		messages: {
			'en_US': {...enLocale,...en},
			'zh_CN':{...zhLocale, ...cn}
		}
	});
	//Vue.prototype.victor = app.i18n;
	// app.i18n.path = (link) => {
	// 	if (app.i18n.locale === app.i18n.fallbackLocale) {
	// 		return `/${link}`;
	// 	}
	// 	return `/${app.i18n.locale}/${link}`;
	// }
}
